/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.mighty.team.homemediacenterdescriptor.init;

import com.mighty.team.homemediacenterdescriptor.json.DataExtractor;
import com.mighty.team.homemediacenterdescriptor.json.JsonParser;
import com.mighty.team.homemediacenterdescriptor.model.Movie;
import com.mighty.team.homemediacenterdescriptor.service.MovieService;
import java.io.IOException;
import java.util.logging.Level;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Controller;
import java.util.logging.Logger;
/**
 *
 * @author TSokolowski
 */
@Controller
public class OnSupport {

    @Autowired
    @Qualifier("movieServiceImpl")
    private MovieService movieService;
    @Autowired
    private DataExtractor dataExtractor;
    @Autowired
    private JsonParser jsonParser;
    private final static Logger LOGGER = Logger.getLogger(OnSupport.class .getName());
    public String test() {
        try{
        movieService.addMovie(dataExtractor.movieDetailsExtractor(jsonParser.readJsonFromUrl("http://www.omdbapi.com/?i=&t=The+Lord+of+the+Rings%3A+The+Return+of+the+King")));
        }catch(IOException iOException){
          LOGGER.log(Level.ALL, "Exception: " + iOException);
        }
        return "Success";
    }
}
